﻿using Knlght.Domain;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Knight.Models.Entity
{
    /// <summary>
    /// 优惠券信息
    /// </summary>
    public class CouponInfo:TEntityBase
    {
        /// <summary>
        /// 主键Id 自增
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 商品id
        /// </summary>
        public string GoodsId { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        public string GoodsName { get; set; }
        /// <summary>
        /// 商品主图
        /// </summary>
        public string CommodityMasterDiagram { get; set; } = "";
        /// <summary>
        /// 商品详情页链接地址
        /// </summary>
        public string CommodityDetailsPageLinkAddress { get; set; } = "";
        /// <summary>
        /// 商品一级类目
        /// </summary>
        public string ClassACommodity { get; set; } = "";
        /// <summary>
        /// 淘宝客链接
        /// </summary>
        public string TaobaoLinks { get; set; } = "";
        /// <summary>
        /// 商品价格(单位：元)
        /// </summary>
        public decimal? CommodityPrice { get; set; }
        /// <summary>
        /// 商品月销量
        /// </summary>
        public int CommodityMonthlySales { get; set; } = 0;
        /// <summary>
        /// 收入比率(%)
        /// </summary>
        public decimal? IncomeRatio { get; set; } 
        /// <summary>
        /// 佣金
        /// </summary>
        public decimal? Commission { get; set; }
        /// <summary>
        /// 卖家旺旺
        /// </summary>
        public string SellerWangWang { get; set; } = "";
        /// <summary>
        /// 卖家id
        /// </summary>
        public string SellerID { get; set; } = "";
        /// <summary>
        /// 店铺名称
        /// </summary>
        public string ShopName { get; set; } = "";
        /// <summary>
        /// 平台类型
        /// </summary>
        public string PlatformType { get; set; } = "";
        /// <summary>
        /// 优惠券id
        /// </summary>
        public string CouponID { get; set; } = "";
        /// <summary>
        /// 优惠券总量
        /// </summary>
        public int CouponTotal { get; set; } = 0;
        /// <summary>
        /// 优惠券剩余量
        /// </summary>
        public int CouponRemaining { get; set; } = 0;
        /// <summary>
        /// 优惠券面额
        /// </summary>
        public string CouponDenomination { get; set; } = "";
        /// <summary>
        /// 优惠券金额
        /// </summary>
        public decimal CouponAmount { get; set; }
        /// <summary>
        /// 优惠券开始时间
        /// </summary>
        public DateTime CouponStartTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 优惠券结束时间
        /// </summary>
        public DateTime CouponEndTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 优惠券链接
        /// </summary>
        public string CouponLink { get; set; } = "";
        /// <summary>
        /// 商品优惠券推广链接
        /// </summary>
        public string MerchandiseCouponPromotionLink { get; set; } = "";
    }

    public class CouponInfoMapping : EntityTypeConfiguration<CouponInfo>
    {
        public CouponInfoMapping()
        {
            // 设置表名
            this.ToTable("T" + nameof(CouponInfo));
            //设置主键
            HasKey(a => a.Id);
            //自增
            this.Property(a => a.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

        }
    }
}
